package com.ymatou.iapi.sellertrade.service;

import com.google.gson.Gson;
import com.ymatou.iapi.sellertrade.parameter.GetOrderListRequestJavaBean;
import com.ymatou.iapi.sellertrade.response.GetOrderListResponseJavaBean;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;

public class GetOrderListJavaCall extends YmatouAutoTestCall{
	
	private static String opurl = "/api/orderquery/getorderlist";
	
	public GetOrderListJavaCall(){
		super(EnvSetup.getSystemUrl("sellertrade_iapi"),opurl,"POST","JSON");
	}
	
	public GetOrderListJavaCall(long sellerid) {
		super(EnvSetup.getSystemUrl("sellertrade_iapi"),opurl + "?sellerid=" + sellerid,"POST","JSON");
		// TODO Auto-generated constructor stub
	}

	public void addDefHeader(){
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		GetOrderListRequestJavaBean request = new GetOrderListRequestJavaBean();
		GetOrderListJavaCall call = new GetOrderListJavaCall(3383);
		
		request.setTradingStatus(0);
		request.setStartTime("2018-03-28 00:00:00");
		request.setEndTime("2018-08-24 23:59:59");
		request.setOvertimeType(0);
		request.setPage(1);
		request.setPageSize(20);
		request.setPackageDelivery(0);
		
		String json = call.callAndGetReturnData(request).toString();
		
		GetOrderListResponseJavaBean response = new Gson().fromJson(json, GetOrderListResponseJavaBean.class);
		
		System.out.println(response);
	}
}
